{{- if .Values.controlPlane.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "kuma.controlPlane.serviceName" . }}
  namespace: {{ .Release.Namespace }}
  {{- with .Values.controlPlane.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  labels: {{ include "kuma.cpLabels" . | nindent 4 }}
spec:
  ingressClassName: {{ .Values.controlPlane.ingress.ingressClassName }}
  rules:
  - host: {{ .Values.controlPlane.ingress.hostname }}
    http:
      paths:
      - path: {{ .Values.controlPlane.ingress.path }}
        pathType: {{ .Values.controlPlane.ingress.pathType }}
        backend:
          service:
            name: {{ include "kuma.controlPlane.serviceName" . }}
            port:
              number: {{ .Values.controlPlane.ingress.servicePort }}
{{- end }}
